
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].[gspCity_SEARCH]
(
@id int = null,
@countryId int = null,
@regionId int = null,
@name nvarchar(128) = null,
@isVisible bit = null
)
AS

SELECT
  *
FROM
  [dbo].[City]
WHERE
  (@id IS NULL OR [Id] = @id)
AND
  (@countryId IS NULL OR [CountryId] = @countryId)
AND
  (@regionId IS NULL OR [RegionId] = @regionId)
AND
  (@name IS NULL OR @name = '' OR [Name] = @name)
AND
  (@isVisible IS NULL OR [IsVisible] = @isVisible)

GO
